Conversation
Copilot
AI
changed the title
[WIP] Fix OpenAIChatCompletion integration test failure
Fix RunStreamingAsync not including chat history in messages sent to chat client
Feb 10, 2026
…lient RunCoreStreamingAsync was passing inputMessagesForProviders (which lacks chat history) to GetStreamingResponseAsync instead of inputMessagesForChatClient (which includes chat history). This caused streaming runs to lose conversation context on subsequent calls. The non-streaming path (RunCoreAsync) already correctly used inputMessagesForChatClient. This aligns the streaming path to match. Also adds a unit test that validates chat history is included in messages sent to the chat client during streaming on subsequent calls. Co-authored-by: lokitoth <6936551+lokitoth@users.noreply.github.com>
6572440 to
a76f2e2
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a streaming conversation-history bug in ChatClientAgent where the streaming path was sending only the current input to the chat client, instead of chat history + current input (matching the non-streaming path). This restores multi-turn context for streaming runs and addresses the failing SessionMaintainsHistoryAsync streaming scenario.
Changes:
- Update
ChatClientAgent.RunCoreStreamingAsyncto passinputMessagesForChatClientintoGetStreamingResponseAsync. - Add a unit test validating that a second streaming call on the same session includes prior turn history in the messages sent to the chat client.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| dotnet/src/Microsoft.Agents.AI/ChatClient/ChatClientAgent.cs | Fix streaming invocation to send chat-history-inclusive message list to the underlying IChatClient. |
| dotnet/tests/Microsoft.Agents.AI.UnitTests/ChatClient/ChatClientAgentTests.cs | Add regression test ensuring streaming calls include prior session history on subsequent turns. |
dotnet/tests/Microsoft.Agents.AI.UnitTests/ChatClient/ChatClientAgentTests.cs
Show resolved
Hide resolved
westey-m
approved these changes
Feb 10, 2026
SergeyMenshykh
approved these changes
Feb 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
SessionMaintainsHistoryAsyncstreaming tests fail consistently becauseRunCoreStreamingAsyncpassesinputMessagesForProviders(current input only) toGetStreamingResponseAsyncinstead ofinputMessagesForChatClient(chat history + current input). The non-streaming path already uses the correct collection. Without chat history, follow-up questions like "And Austria?" after "What is the capital of France?" lack context and the model can't infer intent.Description
One-line fix in
ChatClientAgent.RunCoreStreamingAsync: swapinputMessagesForProviders→inputMessagesForChatClientin theGetStreamingResponseAsynccall, matching the non-streaming path.Added a unit test that makes two streaming calls on the same session and asserts the second call's messages include prior chat history (3 messages: original user message, assistant response, follow-up).
Contribution Checklist
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.